
 package com.ami.kvm.jviewer.gui;
 
 import com.ami.kvm.jviewer.Debug;
 import com.ami.kvm.jviewer.JViewer;
 import java.util.Enumeration;
 import java.util.MissingResourceException;
 import java.util.Properties;
 import java.util.ResourceBundle;
 import javax.swing.JOptionPane;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 public class LocaleStrings
 {
   private static LocaleStrings localeStrings = new LocaleStrings();
   private ResourceBundle resourceBundle = null;
   private ResourceBundle resourceBundleSOC = null;
   private ResourceBundle resourceBundleOEM = null;
   private ResourceBundle prevresourceBundle = null;
   private ResourceBundle prevresourceBundleSOC = null;
   private ResourceBundle prevresourceBundleOEM = null;
   private ResourceBundle parentResourceBundle = null;
   private ResourceBundle parentResourceBundleSOC = null;
   private ResourceBundle parentResourceBundleOEM = null;
   private String errorMsg = "";
   
 
 
 
   private LocaleStrings()
   {
     this.parentResourceBundle = ResourceBundle.getBundle("com.ami.kvm.jviewer.lang.Resources_EN");
     this.parentResourceBundleSOC = ResourceBundle.getBundle("com.ami.kvm.jviewer.soc.lang.SOCResources_EN");
     try {
       this.parentResourceBundleOEM = ResourceBundle.getBundle("com.ami.kvm.jviewer.oem.lang.OEMResources_EN");
     } catch (Exception localException) {
       this.parentResourceBundleOEM = null;
     }
     this.resourceBundle = this.parentResourceBundle;
     this.resourceBundleSOC = this.parentResourceBundleSOC;
     this.resourceBundleOEM = this.parentResourceBundleOEM;
     this.prevresourceBundle = this.resourceBundle;
     this.prevresourceBundleSOC = this.resourceBundleSOC;
     this.prevresourceBundleOEM = this.resourceBundleOEM;
   }
   
 
 
 
 
 
   public static void setLanguageID(String paramString)
   {
     if ((paramString.length() == 0) || (paramString.equals(null))) {
       return;
     }
     try {
       localeStrings.prevresourceBundle = localeStrings.resourceBundle;
       localeStrings.resourceBundle = ResourceBundle.getBundle("com.ami.kvm.jviewer.lang.Resources_" + paramString);
     } catch (MissingResourceException localMissingResourceException1) {
       Debug.out.println(localMissingResourceException1 + getString("AC_2_LS"));
       
 
       localeStrings.resourceBundle = ResourceBundle.getBundle("com.ami.kvm.jviewer.lang.Resources_EN");
     }
     try
     {
       localeStrings.prevresourceBundleOEM = localeStrings.resourceBundleOEM;
       localeStrings.resourceBundleOEM = ResourceBundle.getBundle("com.ami.kvm.jviewer.oem.lang.OEMResources_" + paramString);
     } catch (MissingResourceException localMissingResourceException2) {
       Debug.out.println(localMissingResourceException2 + getString("AC_2_LS"));
       
 
       localeStrings.resourceBundleOEM = ResourceBundle.getBundle("com.ami.kvm.jviewer.oem.lang.OEMResources_EN");
     }
     try
     {
       localeStrings.prevresourceBundleSOC = localeStrings.resourceBundleSOC;
       localeStrings.resourceBundleSOC = ResourceBundle.getBundle("com.ami.kvm.jviewer.soc.lang.SOCResources_" + paramString);
     } catch (MissingResourceException localMissingResourceException3) {
       Debug.out.println(localMissingResourceException3 + getString("AC_3_LS"));
       
 
       localeStrings.resourceBundle = ResourceBundle.getBundle("com.ami.kvm.jviewer.lang.Resources_EN");
       localeStrings.resourceBundleSOC = ResourceBundle.getBundle("com.ami.kvm.jviewer.soc.lang.SOCResources_EN");
       localeStrings.resourceBundleOEM = ResourceBundle.getBundle("com.ami.kvm.jviewer.oem.lang.OEMResources_EN");
       localeStrings.errorMsg = getString("AC_4_LS");
       JOptionPane.showMessageDialog(null, localeStrings.errorMsg, getString("AC_1_LS"), 0);
       JViewer.setLanguage("EN");
       
       JViewer.setDefaultLang(true);
     }
   }
   
 
 
 
 
 
 
   public static String getString(String paramString)
   {
     String str1 = getOEMString(paramString);
     if (str1 != null)
       return str1;
     if (containsKey(localeStrings.resourceBundle, paramString)) {
       return localeStrings.resourceBundle.getString(paramString);
     }
     
     String str2 = localeStrings.resourceBundle.toString();
     Debug.out.printError("The resource for the key " + paramString + " is missing in the resource bundle " + str2.substring(0, str2.indexOf('@')));
     
 
     if (containsKey(localeStrings.parentResourceBundle, paramString)) {
       return localeStrings.parentResourceBundle.getString(paramString);
     }
     str2 = localeStrings.parentResourceBundle.toString();
     Debug.out.printError("The resource for the key " + paramString + " is missing in the resource bundle " + str2.substring(0, str2.indexOf('@')));
     
 
     return null;
   }
   
 
 
 
 
 
 
 
 
 
   private static String convertResourceBundleToProperties(ResourceBundle paramResourceBundle, String paramString)
   {
     Properties localProperties = new Properties();
     Enumeration localEnumeration = paramResourceBundle.getKeys();
     while (localEnumeration.hasMoreElements()) {
       String str = (String)localEnumeration.nextElement();
       if (paramString.equalsIgnoreCase(paramResourceBundle.getString(str)))
       {
         return str;
       }
     }
     return null;
   }
   
 
 
 
 
 
 
   public static String getStringKey(String paramString)
   {
     String str = null;
     try
     {
       str = convertResourceBundleToProperties(localeStrings.prevresourceBundleSOC, paramString);
       
       if (str == null) {
         str = convertResourceBundleToProperties(localeStrings.prevresourceBundleOEM, paramString);
       }
       
       if (str == null) {
         str = convertResourceBundleToProperties(localeStrings.prevresourceBundle, paramString);
       }
     } catch (MissingResourceException localMissingResourceException) {
       Debug.out.println(localMissingResourceException);
       str = convertResourceBundleToProperties(localeStrings.parentResourceBundleSOC, paramString);
       if (str == null) {
         str = convertResourceBundleToProperties(localeStrings.parentResourceBundleOEM, paramString);
       }
       if (str == null) {
         str = convertResourceBundleToProperties(localeStrings.parentResourceBundle, paramString);
       }
     }
     return str;
   }
   
 
 
 
 
 
   public static String getPreviousLocaleString(String paramString)
   {
     String str = null;
     str = localeStrings.prevresourceBundle.getString(paramString);
     return str;
   }
   
 
 
 
 
 
   public static String getSOCString(String paramString)
   {
     if (containsKey(localeStrings.resourceBundleSOC, paramString)) {
       return localeStrings.resourceBundleSOC.getString(paramString);
     }
     
     String str = localeStrings.resourceBundleSOC.toString();
     Debug.out.printError("The resource for the key " + paramString + " is missing in the resource bundle " + str.substring(0, str.indexOf('@')));
     
 
     if (containsKey(localeStrings.parentResourceBundleSOC, paramString)) {
       return localeStrings.parentResourceBundleSOC.getString(paramString);
     }
     str = localeStrings.parentResourceBundleSOC.toString();
     Debug.out.printError("The resource for the key " + paramString + " is missing in the resource bundle " + str.substring(0, str.indexOf('@')));
     
 
     return null;
   }
   
 
 
 
 
 
 
 
 
   public static String getOEMString(String paramString)
   {
     if (localeStrings.resourceBundleOEM == null) {
       return null;
     }
     if (containsKey(localeStrings.resourceBundleOEM, paramString)) {
       return localeStrings.resourceBundleOEM.getString(paramString);
     }
     
     String str = localeStrings.resourceBundleOEM.toString();
     Debug.out.printError("The resource for the key " + paramString + " is missing in the resource bundle " + str.substring(0, str.indexOf('@')));
     
 
     if (containsKey(localeStrings.parentResourceBundleOEM, paramString)) {
       return localeStrings.parentResourceBundleOEM.getString(paramString);
     }
     str = localeStrings.parentResourceBundleOEM.toString();
     Debug.out.printError("The resource for the key " + paramString + " is missing in the resource bundle " + str.substring(0, str.indexOf('@')));
     
 
     return null;
   }
   
 
 
 
 
 
 
 
 
   private static boolean containsKey(ResourceBundle paramResourceBundle, String paramString)
   {
     boolean bool = false;
     if ((paramResourceBundle == null) || (paramString == null))
       return bool;
     Enumeration localEnumeration = paramResourceBundle.getKeys();
     while (localEnumeration.hasMoreElements()) {
       if (((String)localEnumeration.nextElement()).equalsIgnoreCase(paramString)) {
         bool = true;
       }
     }
     
     return bool;
   }
 }


/* Location:              D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\kvm\jviewer\gui\LocaleStrings.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       0.7.1
 */